<script type="ts" setup>
import { ref } from 'vue';
const sum = ref(0);
function addition(){
sum.value = 0;
for (let i = 1; i <= 100; i++) {
sum.value += i;
}
};
</script>
<template>
  <input type="submit" @click="addition" value="点击计算 1~100 的和值" />
  <p>1 到 100 的累加值是: {{ sum }}</p>
</template>
<style>
input,
p {
  width: 200px;
  text-align: center;
  margin: 20px;
}
</style>
